﻿// JavaScript Document
jQuery(document).ready(function(e) {
    jQuery(".carousel").carousel({
			interval: 3000
		});
    star();
    jQuery(".accordion-toggle").addClass("list-group-item");
    jQuery(".list-group-item").addClass("my-list-group-item");
    jQuery(".accordion-inner>a").addClass("btn my-left-btn");
	
	jQuery("#my-left-menu").addClass("be-visible");


});
jQuery(document).scroll(function(e) {
	if( document.body.scrollTop != 0 ){//对谷歌浏览器
		if( document.body.scrollTop > 220 ) {
			jQuery("#my-menu").addClass("navbar-fixed-top");
		}
		if( document.body.scrollTop < 220 ) {
			jQuery("#my-menu").removeClass("navbar-fixed-top");

		}
	}else if( document.documentElement.scrollTop != 0 ){//对火狐浏览器
		if( document.documentElement.scrollTop > 220 ) {
			jQuery("#my-menu").addClass("navbar-fixed-top");
		}
		if( document.documentElement.scrollTop < 220 ) {
			jQuery("#my-menu").removeClass("navbar-fixed-top");
		}
	}
    
});

var num = 0;
var allNum = 4;
function nextAboutAudio() {
	var theOld = jQuery("#the-about-audio audio").attr("src");
	var theNew = theOld.substr(0, 16);
	num ++;
	if(num > allNum - 1) {
		num -= allNum;
	}
	var theNext = theNew + num;
	var newAudioStr = "<audio src=\"" + theNext + ".mp3\" controls autoplay></audio>";
	jQuery("#the-about-audio>div>audio").remove();
	jQuery("#the-about-audio>div").prepend(newAudioStr);
}
function lastAboutAudio() {
	var theOld = jQuery("#the-about-audio audio").attr("src");
	var theNew = theOld.substr(0, 16);
	num --;
	if(num < 0) {
		num += allNum;
	}
	var theNext = theNew + num;
	var newAudioStr = "<audio src=\"" + theNext + ".mp3\" controls autoplay></audio>";
	jQuery("#the-about-audio>div>audio").remove();
	jQuery("#the-about-audio>div").prepend(newAudioStr);
}

function star() {
	jQuery("#star005>img").animate({
		width: "10%",
		height: "10%",
		opacity: "0.5",
		top: "45%",
		left: "45%"
	}, "slow", starBack);
	jQuery("#star004>img").animate({
		width: "100%",
		height: "100%",
		opacity: "1",
		top: "0px",
		left: "0px"
	}, "slow");
	jQuery("#star003>img").animate({
		width: "100%",
		height: "100%",
		opacity: "1",
		top: "0px",
		left: "0px"
	}, "slow");
	jQuery("#star002>img").animate({
		width: "10%",
		height: "10%",
		opacity: "0.5",
		top: "45%",
		left: "45%"
	}, "slow");
	jQuery("#star001>img").animate({
		width: "10%",
		height: "10%",
		opacity: "0.5",
		top: "45%",
		left: "45%"
	}, "slow");
}
function starBack() {
	jQuery("#star005>img").animate({
		width: "100%",
		height: "100%",
		opacity: "1",
		top: "0px",
		left: "0px"
	}, "slow", star);
	jQuery("#star004>img").animate({
		width: "10%",
		height: "10%",
		opacity: "0.5",
		top: "45%",
		left: "45%"
	}, "slow");
	jQuery("#star003>img").animate({
		width: "10%",
		height: "10%",
		opacity: "0.5",
		top: "45%",
		left: "45%"
	}, "slow");
	jQuery("#star002>img").animate({
		width: "100%",
		height: "100%",
		opacity: "1",
		top: "0px",
		left: "0px"
	}, "slow");
	jQuery("#star001>img").animate({
		width: "100%",
		height: "100%",
		opacity: "1",
		top: "0px",
		left: "0px"
	}, "slow");
}
function paopao() {
	var theWords = jQuery("#putMessage").val();
	// alert(theWords);
	var addPaopao = "<div class=\"panel\"><div class=\"panel-body\">";
	addPaopao += "<div class=\"goto-left\"></div><div class=\"message-paopao\">";
	addPaopao += theWords;
	addPaopao += "</div></div></div>";
	jQuery("#my-message").prepend(addPaopao);
}